﻿using MDT.LifeSewagePlatform.Conmmon;
using MDT.LifeSewagePlatform.InterfaceService;
using MDT.LifeSewagePlatform.Entity;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;

namespace MDT.LifeSewagePlatform.ServiceInstance.Controllers
{
    /// <summary>
    /// 
    /// </summary>
    [Route("api/alarm")]
    [ApiController]
    [Authorize]
    public class AlarmController : BaseController
    {
        [Autowired]
        private IAlarmService _alarmService { get; set; }
        /// <summary>
        /// 获取预警设置
        /// </summary>
        /// <param name="Params"></param>
        /// <returns></returns>
        [HttpGet()]
        [CustomActionFilter(Role = RoleType.Child)]
        public async Task<BaseMessage> GetAlarm([FromQuery] AlarmParameter Params)
        {
          
            Params.Year= Params.Year<=0 ? DateTime.Now.Year : Params.Year;
            var UserInfo = CurrentUserInfo();
            return await _alarmService.GetAlarms(Params,UserInfo);
        }
    }
}
